<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>我的好友</title>
<?php include(DEDEMEMBER."/templets/head_inc.htm"); ?>
<script type="text/javascript" language="javascript">
//获得选中文件的文件名
function GetCheckfolderItem()
{
	var allSel='';
	if(document.form1.selid.value) return document.form1.selid.value;
	for(i=0;i<document.form1.selid.length;i++)
	{
		if(document.form1.selid[i].checked)
		{
			if(allSel=='')
			allSel=document.form1.selid[i].value;
			else
			allSel=allSel+","+document.form1.selid[i].value;
		}
	}
	return allSel;
}

function DelSel(ftype)
{
	var selid = GetCheckfolderItem();
	if(selid=='') {
		alert("你没选中任何好友！");
		return false;
	}
	if(window.confirm("你确定要删除这些好友么？"))
	{
		location = "myfriend.php?dopost=del&ids="+selid+"&ftype="+ftype;
	}
}

function ConvSta(sta,ftype)
{
	var selid = GetCheckfolderItem();
	var stamsg = '';
	if(selid=='') {
		alert("你没选中任何好友！");
		return false;
	}

	if(sta=='good') stamsg = '加入关注的好友';
	else if(sta=='bad') stamsg = '加入黑名单';
	else stamsg = '改为普通好友';

	if(window.confirm("你确定要把这些好友"+stamsg+"么？"))
	{
		location = "myfriend.php?dopost=upsta&sta="+sta+"&ids="+selid+"&ftype="+ftype;
	}
}

</script>
</head>
<body>
<?php include(DEDEMEMBER."/templets/head.htm"); ?>
<div class="wrapper lineT">
  <div class="mainBox">
    <div class="main">
      <?php include(DEDEMEMBER."/templets/menu.php"); ?>
      <div class="dedeMain">
        <div class="location">
          <?php if($ftype == '0') echo '所有好友';?>
          <?php if($ftype == '1') echo '关注好友';?>
          <?php if($ftype == '-1') echo '黑名单';?>
        </div>
        <div class="titleTabBar bgGreen lineTB">
          <ul>
            <li class="select"><a href="myfriend.php?ftype=0">所有好友</a></li>
            <li><a href="search.php">查找好友</a></li>
            <li><a href="visit-history.php?dopost=viewme">关注我的人</a></li>
            <li><a href="visit-history.php?dopost=meview">我最近访问</a></li>
          </ul>
        </div>
        <div class="mTB10 mL10 mR10">
          <div class="titleBar bgGrass lineB mB10">
            <div class="fLeft"><strong>
              <?php if($ftype == '0') echo '所有好友';?>
              <?php if($ftype == '1') echo '关注好友';?>
              <?php if($ftype == '-1') echo '黑名单';?>
              </strong><em>(<?php echo $dlist->totalResult;?>)</em></div>
            <div class="fRight titSecondary white" style="margin-top:5px;"> <em><a href="myfriend.php?ftype=0">全部</a></em> <em class="mL10 mR10"><a href="myfriend.php?ftype=1">特别关注</a></em> <em><a href="myfriend.php?ftype=-1">黑名单</a></em> </div>
          </div>
          <form name='form1' action="myfriend.php" method="post">
            <input type='hidden' name='ftype' value='del' />
            {dede:datalist}
            <div class="item friend">
              <div class="itemHead" >
                <div class="fLeft"> <span class="itemHeadTitle yellow"><img class="lineBorder mR10" align="top" src="<?php echo getUserInfo($fields['fid'],'face');?>" width="16" height="16" /><a href='index.php?uid=<?php echo urlencode($fields['floginid']); ?>' target='_blank'><?php echo $fields['funame']; ?></a></span><span class="itemTip mL10"><?php echo getUserInfo($fields['fid'],'sign');?></span></div>
                <div class="fRight">
                  <input type="checkbox" name="selid" value="<? echo $fields['id']; ?>" />
                </div>
                <div class="clear"></div>
              </div>
              <div class="itemBody invisible" >
                <div class="itemContent"> 加入时间:<?php echo MyDate('Y-m-d H:i:s',$fields['addtime']); ?> <a href="pm.php?dopost=send&uid=<?php echo urlencode($fields['floginid']); ?>">[发消息]</a></div>
                <div class="itemBodyFoot"></div>
              </div>
            </div>
            <hr class="dotted" />
            {/dede:datalist}
            <div>
              <div class="fLeft">
                <button class="buttonGary2" type="button" id="checkedClick" >全选</button>
                <button class="buttonGary2 mL10 mR10" onclick="DelSel('<?php echo $ftype; ?>');" type="button" >删除</button>
                <?php if(empty($ftype)) { ?>
                <button class="buttonGary2" onclick="ConvSta('good','<?php echo $ftype; ?>');" type="button" >关注</button>
                <button class="buttonGary5 mL10 mR10" onclick="ConvSta('bad','<?php echo $ftype; ?>');" type="button" >加入黑名单</button>
                <?php }else { ?>
                <button class="buttonGary5" onclick="ConvSta('common','<?php echo $ftype; ?>');" type="button"  >还原为普通</button>
                <?php } ?>
              </div>
              <div class="pages fRight">{dede:pagelist listsize=5 /}</div>
              <div class="clear"></div>
            </div>
          </form>
        </div>
      </div>
      <div class="clear"></div>
    </div>
    <div class="clear"></div>
  </div>
</div>
<?php include(DEDEMEMBER."/templets/foot.htm"); ?>
</div>
</body>
</html>